<cfinvoke component="components.data" method="category" returnvariable="categorys">
<cfinvoke component="components.data" method="five_star_area_category" returnvariable="area">
<cfinvoke component="components.data" method="expertise" returnvariable="expertise">
<cfparam default="0" name="url.action">
<cfcontent reset="yes">

<cfswitch expression="#url.action#"> 
<cfcase value="add_poc">

<cfloop from="1" to="#listlen(id,'_')#" index="i">
<cfset tmp = listgetat(id,i,"_")><cfset tmp2 = session.username>
<cftry>
<cfquery  datasource="#session.dsn#"  >
INSERT INTO current_selections (poc_id,user_id) VALUES (#tmp#,'#tmp2#')
</cfquery>
<cfcatch type="any">
</cfcatch>
</cftry>
</cfloop>

<cfset result_message = ''>
<cfinvoke component="components.data" method="current_selections" returnvariable="selections">
	<cfset result_message = '{"report_poc":['>
	<cfloop query="selections">
		<cfset result_message =  result_message & '{"poc_id":"' & Session.helpers.add_json_escapement(selections.poc_id) & '","first_name":"' & Session.helpers.add_json_escapement(selections.first_name) & '","last_name":"' & Session.helpers.add_json_escapement(selections.last_name) & '","email":"' & Session.helpers.add_json_escapement(selections.email) &   '"},'>
	</cfloop>
	<cfset result_message = Session.helpers.remove_comma_from_end_of_string(result_message)>
	<cfset result_message = result_message & ']}'>
<cfcontent type="text/html" reset="yes"><cfoutput>#result_message#</cfoutput>
</cfcase>

<cfcase value="display">
<cfinvoke component="components.data" method="current_selections" returnvariable="selections">
<cfset result_message = ''>
	<cfset result_message = '{"report_poc":['>
	<cfloop query="selections">
		<cfset result_message =  result_message & '{"poc_id":"' & Session.helpers.add_json_escapement(selections.poc_id) & '","first_name":"' & Session.helpers.add_json_escapement(selections.first_name) & '","last_name":"' & Session.helpers.add_json_escapement(selections.last_name) & '","email":"' & Session.helpers.add_json_escapement(selections.email) &  '"},'>
	</cfloop>
	<cfset result_message = Session.helpers.remove_comma_from_end_of_string(result_message)>
	<cfset result_message = result_message & ']}'>
<cfcontent type="text/html" reset="yes"><cfoutput>#result_message#</cfoutput>
</cfcase>

<cfcase value="delete_poc">
<cfinvoke component="components.data" method="delete_cart_by_id" id="#id#">
<cfinvoke component="components.data" method="current_selections" returnvariable="selections">
<cfset result_message = ''>
	<cfset result_message = '{"report_poc":['>
	<cfloop query="selections">
		<cfset result_message =  result_message & '{"poc_id":"' & Session.helpers.add_json_escapement(selections.poc_id) & '","first_name":"' & Session.helpers.add_json_escapement(selections.first_name) & '","last_name":"' & Session.helpers.add_json_escapement(selections.last_name) & '","email":"' & Session.helpers.add_json_escapement(selections.email) &  '"},'>
	</cfloop>
	<cfset result_message = Session.helpers.remove_comma_from_end_of_string(result_message)>
	<cfset result_message = result_message & ']}'>

<cfcontent type="text/html" reset="yes"><cfoutput>#result_message#</cfoutput>
</cfcase>

<cfcase value="new">

<Cfset tmp = ArrayNew(1)>
<Cfset poc_id_string = "">

<cfinvoke component="components.data" method="find_all_current_selections" returnvariable="current_selections">
<cfloop from="1" to="#current_selections.recordcount#" index="i">
<Cfset tmp[i] = current_selections.poc_id[i]>
<Cfset poc_id_string = poc_id_string & current_selections.poc_id[i] & ","  >
</cfloop>
<cfquery name="insert_report" datasource="#Session.dsn#">
insert into five_star_reports (report_description, report_date, poc_id,user_id)
values ('#info#','#dateformat(now())#', '#poc_id_string#', '#session.username#')
</cfquery>

</cfcase>

<cfcase value="old">

<cfinvoke component="components.data" method="get_report_list" returnvariable="get_all" id="#info#">
<cfinvoke component="components.data" method="current_selections" returnvariable="find_all_current_selections">
<cfset report_pocs = '#get_all.poc_id#'>
<Cfset tmp = ArrayNew(1)>
<Cfset poc_id_string = "">

<cfloop from="1" to="#find_all_current_selections.recordcount#" index="i">
<Cfset tmp[i] = find_all_current_selections.poc_id[i]>

<cfif ListContainsNoCase(report_pocs,tmp[i],",") eq 0>
<cfset report_pocs = ListAppend(report_pocs,tmp[i],",")>
</cfif>

</cfloop>
<cfquery datasource="#session.dsn#" name="update">
update five_star_reports
set 
poc_id = '#report_pocs#'
where report_id = #info#
</cfquery>

</cfcase>

<cfcase value="load_old_reports">
<cfinvoke component="components.data" method="get_reports" returnvariable="selections">
<cfset result_message = ''>
<cfset result_message = '{"old_reports":['>
<cfloop query="selections">
<cfset result_message =  result_message & '{"report_id":' & Session.helpers.add_json_escapement(selections.report_id) & ',"report_description":"' & Session.helpers.add_json_escapement(selections.report_description) & '","report_date":"' & Session.helpers.add_json_escapement(selections.report_date) & '"},'></cfloop>
	<cfset result_message = Session.helpers.remove_comma_from_end_of_string(result_message)>
	<cfset result_message = result_message & ']}'>

<cfcontent type="text/html" reset="yes"><cfoutput>#result_message#</cfoutput>
</cfcase>

<cfcase value="clear_cart">

<cfquery name="delete" datasource="#session.dsn#">
delete * from current_selections
</cfquery>
</cfcase>

</cfswitch>